import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP


class c73300c:
    name = "验证登录功能-73300c"
    driver = webdriver.Firefox()

    def teststeps(self):
        self.driver.implicitly_wait(3)
        self.driver.get("http://172.17.66.19:8080/")

        STEP(3, '输入已注册的账号和正确的密码，回车登录')
        self.driver.find_element(By.NAME, "username").send_keys("user4")
        self.driver.find_element(By.NAME, "password").click()
        self.driver.find_element(By.NAME, "password").send_keys("123456")
        self.driver.find_element(By.NAME, "password").send_keys(Keys.ENTER)
        expeted_words = "产品列表"
        key_words = self.driver.find_element(By.CSS_SELECTOR,
                                             "#app > div > div.main-container > section > div.el-card.card.is-always-shadow > div > div:nth-child(1) > span").text
        CHECK_POINT("验证是否为期待文字", expeted_words == key_words)

        self.driver.quit()